package myPackage;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CursusManager extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    public CursusManager() {
        super();
    }

       
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	
	
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		ArrayList<Horaires> horaire;
		Horaires tmpHoraire = new Horaires();
		
		if( (request.getServletContext().getAttribute("ahoraire")) ==null) {
			horaire = new ArrayList<Horaires>();
			request.getServletContext().setAttribute("ahoraire", horaire);		
		}else {
			horaire = (ArrayList<Horaires>) request.getServletContext().getAttribute("ahoraire");
		}
				
		if(request.getParameter("plusCursusName")!=null && request.getParameter("plusCursusName")!=""){
			tmpHoraire.setNomFormateur(request.getParameter("plusCursusName"));
			tmpHoraire.setNomFormation(request.getParameter("plusTrainerName"));
			tmpHoraire.setNomModule(request.getParameter("plusModuleName"));
			tmpHoraire.setDuree(Integer.parseInt(request.getParameter("plusTime")));
			}
		
		
		
		}
		
		
}
